import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn } from "typeorm";
import { STATES } from "../includes/public/enums";

@Entity()
export class Plugins {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({type: "varchar", length: 200, unique: true})
  plugin_tag: string;

  @Column({type: "varchar", length: 200, unique: true})
  plugin_name: string;

  @Column({ type: 'varchar', length: 30, default: ''})
  status: STATES

  @Column({default: false})
  is_menu: boolean;

  @Column({type: "text", default: '{}'})
  menu_setting: string;
}

@Entity()
export class PluginMeta{
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(() => Plugins)
  @JoinColumn({ name: 'plugin_id' })

  @Column({ type: 'varchar', length: 60, unique: true })
  meta_key: string

  @Column({ type: 'text', default: ''})
  meta_value: string;
}